package com.ican.dao.user;

import java.util.Date;

import org.springframework.stereotype.Repository;

import com.ican.common.hibernate.HibernateDao;
import com.ican.domain.user.UserRole;

@Repository("userRoleDao")
public class UserRoleDao extends HibernateDao<UserRole, Integer> {
    
    public void addUserRole(UserRole ur){
        ur.setCreateTime(new Date());
        this.save(ur);
    }
    
    public void removeUserRole(UserRole ur){
        String hql = "delete from UserRole where userId = ? and roleId = ?";
        batchExecute(hql, new Object[]{ur.getUserId(), ur.getRoleId()});
    }
}
